/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mrs.models;

import java.util.*;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import mrs.database.*;

/**
 *
 * @author pablo
 */
public class Guest {
 
  private int id;
  
  public String name;
  public int age;
  public float weightKg;
  public float heightKg;
  public float physicalActivity;
  private Vector<Ingredient> availableIngredientsVector;
  private Set<Ingredient> availableIngredientsSet;
  
  public Guest()
  {
    this.availableIngredientsVector = new Vector<Ingredient>();
    this.availableIngredientsSet = new HashSet();
  }
  
  public Guest(String name, int age, float weightKg, float heightKg, float physicalActivity, Vector<Ingredient> availableIngredients) {
    this.name = name;
    this.age = age;
    this.weightKg = weightKg;
    this.heightKg = heightKg;
    this.physicalActivity = physicalActivity;
    
    for (Ingredient ing : availableIngredients)
    {
      this.addIngredient(ing);
    }
  }
  
  public Guest(String name, int age, float weightKg, float heightKg, float physicalActivity, Set<Ingredient> availableIngredients) {
    this.name = name;
    this.age = age;
    this.weightKg = weightKg;
    this.heightKg = heightKg;
    this.physicalActivity = physicalActivity;
    
    for (Ingredient ing : availableIngredients)
    {
      this.addIngredient(ing);
    }
  }
  
  public void addIngredient(Ingredient ing)
  {
    if (!availableIngredientsVector.contains(ing) && !availableIngredientsSet.contains(ing))
    {
      availableIngredientsVector.add(ing);
      availableIngredientsSet.add(ing);
    }
  }
  
  public void removeIngredient(Ingredient ing)
  {
    if (availableIngredientsVector.contains(ing) && availableIngredientsSet.contains(ing))
    {
      availableIngredientsVector.remove(ing);
      availableIngredientsSet.remove(ing);
    }
  }
  
  public Set<Ingredient> getAvailableIngredientsSet()
  {
    return this.availableIngredientsSet;
  }
  
  public Vector<Ingredient> getAvailableIngredientsVector()
  {
    return this.availableIngredientsVector;
  }


  @Override
  public String toString() {
    return this.name;
  }
  

}
